package com.linkai.JVM;

import java.util.Random;

/**
 * @Description: 堆 测试对内存溢出
 * @Author: 林凯
 * @Date: 2021/10/20 16:27
 */
public class TestHeap {
    public static void main(String[] args) {
        String str = "jacklin";

        while (true) {
            str += str + new Random().nextInt(888888888)
                    + new Random().nextInt(888888888)
                    + new Random().nextInt(888888888);
            /*
                Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
            * */
        }


    }
}
